   import 'dart:async';

import 'package:flutter/material.dart';

   class MyDialogPage extends Dialog {

     String title;
     String content;
     MyDialogPage({this.title='', this.content=''});

     _showTimer(context){
       var timer;
       timer = Timer.periodic(
         Duration(milliseconds: 1500), (t){
          Navigator.pop(context);
          t.cancel(); // 取消定时器
         }
       );
     }
   
     @override
     Widget build(BuildContext context) {

       _showTimer(context);
       return Material(
         type: MaterialType.transparency,
         child: Center(
           child: Container(
             height: 300,
             width: 300,
             color: Colors.white,
             child: Column(
             mainAxisAlignment: MainAxisAlignment.start,
             children: <Widget>[
               Padding(
                 padding: EdgeInsets.all(10),
                 child: Stack(
                   children: <Widget>[
                     Align(
                       alignment: Alignment.center,
                       child: Text('${this.title}'),
                     ),
                     Align(
                       alignment: Alignment.centerRight,
                       child: InkWell(
                         child: Icon(Icons.close),
                         onTap: (){
                           Navigator.pop(context);
                         },
                       ),
                     ),
                   ],
                 ),
              ),
              Divider(),
              Container(
                padding: EdgeInsets.all(10),
                width: double.infinity,
                child: Text('${this.content}', textAlign: TextAlign.left),
              )
             ],
           ),
           ),
         ),
       );
     }

     
   }